#include "RBTree.hpp"

namespace Su
{
    template <class K>
    class Set
    {
    public:
        struct SetofKey//仿函数，用于将node里的key提取出来
        {
            const K& operator()(const K& node)
            {
                return node;
            }
        };

        Set()
        {}
        typedef typename RBTree<K, K, SetofKey>::const_iterator Iterator;
        typedef typename RBTree<K, K, SetofKey>::const_iterator const_Iterator;

        
        pair<Iterator,bool> insert(const K& data)
        {
            pair<typename RBTree<K, K, SetofKey>::iterator, bool> ret = _t.insert(data);
            return pair<Iterator, bool>(ret.first, ret.second);
        }
        bool IsSet()
        {
            return _t.IsBanlance();
        }
        const_Iterator begin() const
        {
            return _t.begin();
        }
        const_Iterator end() const
        {
            return _t.end();
        }
    private:
        RBTree<K, K, SetofKey> _t;
    };
}